package cn.smbms.controller;

import cn.smbms.beans.Role;
import cn.smbms.service.role.RoleService;
import com.alibaba.fastjson.JSONArray;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("role")
public class RoleController {
    private Logger log = Logger.getLogger(RoleController.class);
    @Autowired
    @Qualifier("roleService")
    private RoleService roleService;
@RequestMapping(value = "roleList.html",produces={"text/html;charset=UTF-8;","application/json;"})
@ResponseBody
    public  String getRoleList(){
    List<Role> roleList = roleService.getRoleList();
    String s = JSONArray.toJSONString(roleList);
    log.debug("json类型的角色信息："+ s);
    return s;
}

}
